<template>
	<div class="app">
		<my-navbar title="我的订单"></my-navbar>
		<tabbar ref="reflectName" class="tabbar" tabType="top" textSelectColor="red" textUnselectColor="black" @ready="ready"  @pageSelected="pageSelected"
		 tabBackgroundColor="#f2f2f2" :tabPages="tabPages"></tabbar>

	</div>
</template>

<style>
	.app {
		background-color: rgba(248, 248, 248, 0.8);
	}

	.app {
		flex: 1
	}

	.tabbar {
		flex: 1;
		width: 750px;
	}

	.navbar {
		width: 750px;
		height: 100px;
	}

	.text {
		font-size: 26px;
	}
</style>

<script>
	import myNavbar from '../../components/myNavbar/myNavbar.vue'
	export default {
		data() {
			return {
				tabPages: [{
						title: '待付款',
						selectedIcon: 'md-home',
						url: './component/order/payment.js',
						tabName: "payment"
					},
					{
						title: '待发货',
						selectedIcon: 'md-contacts',
						url: './component/order/delivery.js',
						tabName: "delivery"
					},
					{
						title: '待收货',
						selectedIcon: 'md-globe',
						url: './component/order/received.js',
						tabName: "received"
					},
					{
						title: '已完成',
						selectedIcon: 'md-settings',
						url: './component/order/complete.js',
						tabName: "complete"
					},
				],
			}
		},
		created() {
			// this.$refs.reflectName.setCurrentItem('complete')
		},
		components: {
			myNavbar
		},
	
		mounted() {

			// this.$refs.reflectName.setCurrentItem(app.config.params)
			// if (app.config.params == '0'){
			//     _this.$refs.reflectName.setCurrentItem('name');
			// }else if (app.config.params == '1'){
			//     _this.$refs.reflectName.setCurrentItem('payment');
			// } else if (app.config.params == '2'){
			//     _this.$refs.reflectName.setCurrentItem('delivery');
			// }else if (app.config.params == '3'){
			//     _this.$refs.reflectName.setCurrentItem('received');
			// }else if (app.config.params == '4'){
			//     _this.$refs.reflectName.setCurrentItem('evaluation');
			// }
		},
		methods: {
			ready(){
				this.$refs.reflectName.setCurrentItem(app.config.params)
			},
			pageSelected(params) {
				if (params.position == 0) {
					this.$refs.reflectName.reload('payment');
				} else if (params.position == 1) {
					this.$refs.reflectName.reload('delivery');
				} else if (params.position == 2) {
					this.$refs.reflectName.reload('received');
				} else if (params.position == 3) {
					this.$refs.reflectName.reload('complete');
				}
			},
		}
	};
</script>
